<template>
    <div>
        <Modal :title="modalTitle" v-model="modalShow" :width="modalWidth">
            <div>
                <Form label-position="right" :model="formItem">
                    <Row :gutter="16">
                        <Col span="12">
                            <FormItem label="行权事项名称：">
                                {{formItem.title}}
                            </FormItem>
                        </Col>
                        <Col span="12">
                            <FormItem label="行权事项制度名称：">
                                {{formItem.sys_title}}
                            </FormItem>
                        </Col>
                        <Col span="12">
                            <FormItem label="行权类型：">
                                {{type}}
                            </FormItem>
                        </Col>
                        <Col span="12">
                            <FormItem label="现有行权系统：">
                                {{formItem.is_exist_sys == '0' ? '有' : '无'}}
                            </FormItem>
                        </Col>
                        <Col span="24">
                            <FormItem label="行权事项风险问题：">
                                <Row type="flex" v-for="(item, index) in formItem.riskList" :key="index">
                                    <Col span="21" offset="3">
                                        {{index + 1}}： {{item}}
                                    </Col>
                                </Row>
                            </FormItem>
                        </Col>
                        <Col span="24">
                            <FormItem label="行权事项流程（节点）：">
                                <Row type="flex" v-for="(item, index) in formItem.nodeList" :key="index">
                                    <Col span="22" offset="2">
                                        {{index + 1}}： {{item}}
                                    </Col>
                                </Row>
                            </FormItem>
                        </Col>
                    </Row>
                </Form>
            </div>
            <div slot="footer">
                <Button type="text" @click="modalShow = false">关闭</Button>
            </div>
        </Modal>
    </div>
</template>

<script>
export default {
  name: 'optionModal',
  props: {
    modalTitle: {
      type: String,
      default: () => {
        return ''
      }
    },
    modalType: {
      type: String,
      default: () => {
        return 'info'
      }
    },
    // modalShow: {
    //   type: Boolean,
    //   default: () => {
    //     return false
    //   }
    // },
    modalWidth: {
      type: Number,
      default: () => {
        return 800
      }
    },
    dataObj: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data () {
    return {
      formItem: {},
      modalShow: false
    }
  },
  computed: {
    type () {
      switch (this.formItem.type) {
        case '1':
          return '行政征收'
        case '2':
          return '行政裁决'
        case '3':
          return '行政给付'
        case '4':
          return '行政奖励'
        case '5':
          return '行政确认'
        case '6':
          return '行政许可'
        case '7':
          return '行政强制'
        case '8':
          return '行政检查'
        case '9':
          return '行政处罚'
        case '10':
          return '其他权力'
        default:
          return ''
      }
    }
  },
  methods: {
    modalAction () {
      this.modalShow = !this.modalShow
    },
    success (val) {
      val = this.$common.xeUtils.isEmpty(val) ? '操作成功' : val
      this.$Message.success(val)
    },
    error (data) {
      this.$Message.error({
        content: '操作失败,\n' + data.errmsg
      })
    }
  },
  mounted () {
  },
  watch: {
    dataObj (val) {
      this.formItem = val
      this.formItem.nodeList = this.formItem.node.split(',')
      this.formItem.riskList = this.formItem.risk_issues.split(',')
    }
  }
}
</script>

<style scoped>
    .action-btn {
        margin-right: 5px;
        margin-bottom: 5px;
    }

    /deep/ .ivu-form-item-label {
        font-weight: bold;
    }
</style>
